﻿<div id="wrap">
    <div data-ng-include="" src="'views/shared/_nav.html'"></div>
    <div data-ng-include="" src="'views/shared/_navposts.html'"></div>
    <div class="container admin-views-main admin-views-content-pages" data-ng-controller="PagesController">
        <div class="page-header clearfix">
            <h2 class="page-title pull-left">
                {{lbl.pages}} <span id="spinner" class="loaded"><i class="fa fa-spinner fa-spin fa-sm"></i></span>
            </h2>
            <a href="{{SiteVars.RelativeWebRoot}}admin/editor/page.cshtml" class="btn btn-success btn-header pull-right" type="button"><i class="fa fa-plus"></i>{{lbl.addNewPage}}</a>
        </div>
        <div class="toolbar-grid clearfix">
            <div class="pull-left">
                <button ng-click="processChecked('delete')" class="btn btn-danger btn-sm"><i class="fa fa-times"></i>{{lbl.doDelete}}</button>
                <button ng-click="processChecked('publish')" class="btn btn-success btn-sm"><i class="fa fa-check"></i>{{lbl.publish}}</button>
                <button ng-click="processChecked('unpublish')" class="btn btn-info btn-sm"><i class="fa fa-minus"></i>{{lbl.unpublish}}</button>
            </div>
            <div class="pull-right btn-flt-r hmin767"><button class="btn btn-default btn-sm"><i class="fa fa-cog fa-lg"></i><span>{{lbl.filter}}</span></button></div>
            <div class="pull-right filterbar flt-r clearfix">
                <div class="active-flt-r"></div>
                <div class="navbar-left search-grid pull-right">
                    <input type="text" ng-model="query" ng-change="search()" class="input-sm form-control pull-right" placeholder="{{lbl.search}}" />
                </div>
                <div class="btn-toolbar pull-right">
                    <div class="btn-group">
                        <button id="fltr-all" class="btn btn-default btn-sm active" ng-click="gridFilter('IsPublished','all','all')">{{lbl.all}}</button>
                        <button id="fltr-pub" class="btn btn-default btn-sm" ng-click="gridFilter('IsPublished',true,'pub')">{{lbl.published}}</button>
                        <button id="fltr-dft" class="btn btn-default btn-sm" ng-click="gridFilter('IsPublished',false,'dft')">{{lbl.drafts}}</button>
                    </div>
                </div>
                <span class="pull-right lbl-show">{{lbl.show}} :</span>
            </div>
        </div>
        <table class="table table-bordered table-striped table-hover table-responsive">
            <thead>
                <tr>
                    <th><input type="checkbox" id="chkAll" ng-click="checkAll($event)" /></th>
                    <th class="table-item-title table-item-w50">{{lbl.title}} <a data-ng-click="sort_by('Title',$event)"><i class="fa fa-sort"></i></a></th>
                    <th class="hmax992">{{lbl.parent}}</th>
                    <th class="hmax580">{{lbl.createdOn}}</th>
                    <th class="hmax768">{{lbl.showInList}}</th>
                    <th>{{lbl.published}}</th>
                </tr>
            </thead>
            <tbody data-bind="foreach: posts">
                <tr data-ng-repeat="item in pagedItems[currentPage] | orderBy:sortingOrder:reverse">
                    <td><input type="checkbox" id="{{item.Slug}}" data-ng-model="item.IsChecked" /></td>
                    <td class="table-item-title">
                        <a title="{{item.Title}}" class="pull-left text-ellipsis" href="{{SiteVars.RelativeWebRoot}}admin/editor/page.cshtml?id={{item.Id}}"><span class="text-ellipsis">{{item.Title}}</span></a>
                        <a title="{{item.Title}}" target="_new" href="{{SiteVars.RelativeWebRoot}}page/{{item.Slug}}" class="pull-right external-link"><i class="fa fa-external-link"></i></a>
                    </td>
                    <td class="hmax992">{{item.Parent.OptionName}}</td>
                    <td class="hmax580">{{item.DateCreated}}</td>
                    <td class="hmax768"><input type="checkbox" data-ng-model="item.ShowInList" data-ng-disabled="true"></td>
                    <td><input type="checkbox" data-ng-model="item.IsPublished" data-ng-disabled="true"></td>
                </tr>
            </tbody>
        </table>
        <div class="text-right pagination-wrapper">
            <ul class="pagination pagination-sm">
                <li data-ng-class="{disabled: currentPage == 0}">
                    <a data-ng-click="prevPage()">« {{lbl.prev}}</a>
                </li>
                <li data-ng-repeat="n in range(pagedItems.length)" data-ng-class="{active: n == currentPage}" data-ng-click="setPage()">
                    <a data-ng-bind="n + 1">1</a>
                </li>
                <li data-ng-class="{disabled: currentPage == pagedItems.length - 1}">
                    <a data-ng-click="nextPage()">{{lbl.next}} »</a>
                </li>
            </ul>
        </div>
    </div>
</div>
<div id="footer" data-ng-include src="'views/shared/_footer.html'"></div>